<?php
ob_start();
session_start();

$sql="SELECT A.STATUS FROM USER_STATUS A, USUARIOS B WHERE B.USUARIO=\"".$_SESSION["user"]."\" AND B.ID_STATUS=A.ID_STATUS";
$result=mysql_query($sql);
list($status)=mysql_fetch_row($result);


echo"    <div class=\"pag_menu\">
      
      <div id=\"sidebar\" class=\"dbx-group\" style=\"position: relative; display: block;\">";
	  
if($status=="ADMIN")
{      
	echo"	<div class=\"dbx-box dbx-box-closed dbxid0\" id=\"meta1\" style=\"display: block;\">
			<h3 class=\"dbx-handle dbx-handle-cursor\" style=\"position: relative; display: block;\" title=\"a\">
			 Administrador: ".$_SESSION["user"]."
			<a style=\"cursor: pointer;\" href=\"javascript:CambiaClass(0);\" id=\"menu1\" class=\"dbx-toggle dbx-toggle-closed\" title=\"click to open this box\">				&nbsp;             </a>
			</h3>
			<div class=\"dbx-content\">
			<ul>
			<li class=\"pag_menu_item_cat\"><a href=\"Admin_main.php?opt=2\">Configura men&uacute;</a></li>
			<li class=\"pag_menu_item_cat\"><a href=\"Admin_main.php?opt=1\">A&ntilde;ade Entrada</a></li>
			<li class=\"pag_menu_item_cat\"><a href=\"Admin_main.php?opt=3\">Edita Entrada</a></li>
			<li class=\"pag_menu_item_cat\"><a href=\"Admin_logout.php\">Cerrar Session</a></li>
			   
				
			</ul>
			</div>
			</div>";
}
else
{
	echo"	  <div id=\"meta1\" style=\"visibility: hidden;\">
				<a id=\"menu1\"></a>
				</div>";
}
	  
echo"	  <div  class=\"dbx-box dbx-box-closed dbxid0\" id=\"meta2\" style=\"display: block;\">
            <h3 class=\"dbx-handle dbx-handle-cursor\"  style=\"position: relative; display: block;\" title=\"a\">
              OCA
              <a style=\"cursor: pointer;\" href=\"javascript:CambiaClass(1);\" class=\"dbx-toggle dbx-toggle-closed\" id=\"menu2\" title=\"click to open this box\">				&nbsp;
              </a>
            </h3>
            <div class=\"dbx-content\">
              <ul>
                  <li>Cap&iacute;tulo 1: 
                  <div class=\"pag_menu_item\">
                  <a href=\"oca_main.php?cap=1\">Componentes y estructura</a></div>
                 
                  </li>
                  <li> Cap&iacute;tulo 2:
                  <div class=\"pag_menu_item\">
                  <a href=\"oca_main.php?cap=2\">Instalar y administrar Oracle</a></div>
              
                  </li>
                  <li> Cap&iacute;tulo 3:
                  <div class=\"pag_menu_item\">
                  <a href=\"oca_main.php?cap=3\">Objetos de la BBDD</a></div>
             
                  </li>
                  
                  <li> Cap&iacute;tulo 4:
                  <div class=\"pag_menu_item\">
                  <a href=\"oca_main.php?cap=4\">Servicios de red</a></div>
              
                  </li>
                  
                  <li> Cap&iacute;tulo 5:
                  <div class=\"pag_menu_item\">
                  <a href=\"oca_main.php?cap=5\">Servidor Compartido</a></div>
              
                  </li>
                  
                  <li> Cap&iacute;tulo 6:
                  <div class=\"pag_menu_item\">
                  <a href=\"oca_main.php?cap=6\">Administraci&oacute;n de usuarios</a></div>
             
                  </li>
                  
                                    <li> Cap&iacute;tulo 7:
                  <div class=\"pag_menu_item\">
                  <a href=\"oca_main.php?cap=7\">SQL y PL/SQL</a></div>
                
                  </li>
                  
                                    <li> Cap&iacute;tulo 8:
                  <div class=\"pag_menu_item\">
                  <a href=\"oca_main.php?cap=8\">Consistencia y concurrencia</a></div>
             
                  </li>
                  
                                    <li> Cap&iacute;tulo 9:
                  <div class=\"pag_menu_item\">
                  <a href=\"oca_main.php?cap=9\">Mantenimiento y monitoreo</a></div>
               
                  </li>
                  
                                    <li> Cap&iacute;tulo 10:
                  <div class=\"pag_menu_item\">
                  <a href=\"oca_main.php?cap=10\">Backups</a></div>
               
                  </li>
                  
                                    <li> Cap&iacute;tulo 11:
                  <div class=\"pag_menu_item\">
                  <a href=\"oca_main.php?cap=11\">Recuperaci&oacute;n de la base de datos</a></div>
                
                  </li>
                  
              </ul>
            </div>
          </div>
          
            <div class=\"dbx-box dbx-box-closed dbxid0\" id=\"meta3\" style=\"display: block;\">
            <h3 class=\"dbx-handle dbx-handle-cursor\" style=\"position: relative; display: block;\" title=\"a\">
              OCP
              <a style=\"cursor: pointer;\" href=\"javascript:CambiaClass(2);\" id=\"menu3\" class=\"dbx-toggle dbx-toggle-closed\" title=\"click to open this box\">				&nbsp;
              </a>
            </h3>
        <div class=\"dbx-content\">
              <ul>
                  <li>Cap&iacute;tulo 1: 
                  <div class=\"pag_menu_item\">
                  <a href=\"ocp_main.php?cap=1\">Configurar RMAN</a></div>
                 
                  </li>
                  <li> Cap&iacute;tulo 2:
                  <div class=\"pag_menu_item\">
                  <a href=\"ocp_main.php?cap=2\">Ejecutar RMAN</a></div>
              
                  </li>
                  <li> Cap&iacute;tulo 3:
                  <div class=\"pag_menu_item\">
                  <a href=\"ocp_main.php?cap=3\">Recuperar Errores no criticos</a></div>
             
                  </li>
                  
                  <li> Cap&iacute;tulo 4:
                  <div class=\"pag_menu_item\">
                  <a href=\"ocp_main.php?cap=4\">Restaurar y recuperar</a></div>
              
                  </li>
                  
                  <li> Cap&iacute;tulo 5:
                  <div class=\"pag_menu_item\">
                  <a href=\"ocp_main.php?cap=5\">Flashback</a></div>
              
                  </li>
                  
                  <li> Cap&iacute;tulo 6:
                  <div class=\"pag_menu_item\">
                  <a href=\"ocp_main.php?cap=6\">Recuperar errores de usuario</a></div>
             
                  </li>
                  
                   <li> Cap&iacute;tulo 7:
                  <div class=\"pag_menu_item\">
                  <a href=\"ocp_main.php?cap=7\">Bloques corruptos</a></div>
                
                  </li>
                  
                   <li> Cap&iacute;tulo 8:
                  <div class=\"pag_menu_item\">
                  <a href=\"ocp_main.php?cap=8\">ADM</a></div>
             
                  </li>
                  
                   <li> Cap&iacute;tulo 9:
                  <div class=\"pag_menu_item\">
                  <a href=\"ocp_main.php?cap=9\">ASM</a></div>
               
                  </li>
                  
                   <li> Cap&iacute;tulo 10:
                  <div class=\"pag_menu_item\">
                  <a href=\"ocp_main.php?cap=10\">Globalizacion</a></div>
               
                  </li>
                  
                  <li> Cap&iacute;tulo 11:
                  <div class=\"pag_menu_item\">
                  <a href=\"ocp_main.php?cap=11\">Gestionar recursos</a></div>
                
                  </li>
				                  
                  
                  <li> 
				  Cap&iacute;tulo 12:
                  <div class=\"pag_menu_item\">
                  <a href=\"ocp_main.php?cap=12\">Programar tareas</a></div>                
                  </li>
				                    </li>
                  
                  <li>
				  Cap&iacute;tulo 13:
                  <div class=\"pag_menu_item\">
                  <a href=\"ocp_main.php?cap=13\">Gesti&oacute;n almacenamiento</a></div>                
                  </li>
				  <li>
				  Cap&iacute;tulo 14:
                  <div class=\"pag_menu_item\">
                  <a href=\"ocp_main.php?cap=14\">Seguridad</a></div>                
                  </li>
                  
              </ul>
            </div>
          </div>
          
               <div class=\"dbx-box dbx-box-closed dbxid0\" id=\"meta4\" style=\"display: block;\">
            <h3 class=\"dbx-handle dbx-handle-cursor\" style=\"position: relative; display: block;\" title=\"a\">
              SQL
              <a style=\"cursor: pointer;\" href=\"javascript:CambiaClass(3);\" id=\"menu4\" class=\"dbx-toggle dbx-toggle-closed\" title=\"click to open this box\">				&nbsp;
              </a>
            </h3>
            <div class=\"dbx-content\">
              <ul><li> Categorias:
			  <div class=\"pag_menu_item_cat\">";
  $sql="SELECT A.SUBCATEGORIA,A.ID_SUBCATEGORIA, COUNT(*) 
		FROM 
			SUBCATEGORIAS A, CAT_ENTRADAS B, CATEGORIAS C, ENTRADAS D
		WHERE 
		 	 C.ID_CATEGORIA=A.ID_CATEGORIA AND
			 A.ID_SUBCATEGORIA=B.ID_SUBCATEGORIA AND
			 C.CATEGORIA='SQL' AND
			 B.ID_ENTRADA=D.ID_ENTRADA AND
			 D.ACTIVO=1
		GROUP BY 
		 	A.SUBCATEGORIA, A.ID_SUBCATEGORIA
		 ORDER BY 
		 	A.ID_SUBCATEGORIA";
				
			 $result=mysql_query($sql);
			 while( list($categoria, $id_categoria, $count)=mysql_fetch_row($result))
			 {
				echo "<a href=\"sql.php?cat=$id_categoria\">$categoria ($count)</a></br>";	 
			 }
				 
			 

echo"        </div></li></ul>
            </div>
          </div>
          
            <div class=\"dbx-box dbx-box-closed dbxid0\" id=\"meta5\" style=\"display: block;\">
            <h3 class=\"dbx-handle dbx-handle-cursor\" style=\"position: relative; display: block;\" title=\"a\">
              PL/SQL
              <a style=\"cursor: pointer;\" href=\"javascript:CambiaClass(4);\" id=\"menu5\" class=\"dbx-toggle dbx-toggle-closed\" title=\"click to open this box\">				&nbsp;
              </a>
            </h3>
            <div class=\"dbx-content\">
                     <ul><li> Categorias:
			  <div class=\"pag_menu_item_cat\">";
  $sql="SELECT A.SUBCATEGORIA,A.ID_SUBCATEGORIA, COUNT(*) 
		FROM 
			SUBCATEGORIAS A, CAT_ENTRADAS B, CATEGORIAS C, ENTRADAS D
		WHERE 
		 	 C.ID_CATEGORIA=A.ID_CATEGORIA AND
			 A.ID_SUBCATEGORIA=B.ID_SUBCATEGORIA AND
			 C.CATEGORIA='PLSQL' AND
			 B.ID_ENTRADA=D.ID_ENTRADA AND
			 D.ACTIVO=1
		GROUP BY 
		 	A.SUBCATEGORIA, A.ID_SUBCATEGORIA
		 ORDER BY 
		 	A.ID_SUBCATEGORIA";
				
			 $result=mysql_query($sql);
			 while( list($categoria, $id_categoria, $count)=mysql_fetch_row($result))
			 {
				echo "<a href=\"plsql.php?cat=$id_categoria\">$categoria ($count)</a></br>";	 
			 }
			 
echo"        </div></li></ul>
            </div>
          </div>
          
            <div class=\"dbx-box dbx-box-closed dbxid0\" id=\"meta6\" style=\"display: block;\">
            <h3 class=\"dbx-handle dbx-handle-cursor\" style=\"position: relative; display: block;\" title=\"a\">
              ORACLE
              <a style=\"cursor: pointer;\" href=\"javascript:CambiaClass(5);\" id=\"menu6\" class=\"dbx-toggle dbx-toggle-closed\" title=\"click to open this box\">				&nbsp;
              </a>
            </h3>
            <div class=\"dbx-content\">
                     <ul><li> Categorias:
			  <div class=\"pag_menu_item_cat\">";
  $sql="SELECT A.SUBCATEGORIA,A.ID_SUBCATEGORIA, COUNT(*) 
		FROM 
			SUBCATEGORIAS A, CAT_ENTRADAS B, CATEGORIAS C, ENTRADAS D
		WHERE 
		 	 C.ID_CATEGORIA=A.ID_CATEGORIA AND
			 A.ID_SUBCATEGORIA=B.ID_SUBCATEGORIA AND
			 C.CATEGORIA='ORACLE' AND
			 B.ID_ENTRADA=D.ID_ENTRADA AND
			 D.ACTIVO=1
		GROUP BY 
		 	A.SUBCATEGORIA, A.ID_SUBCATEGORIA
		 ORDER BY 
		 	A.ID_SUBCATEGORIA";
				
			 $result=mysql_query($sql);
			 while( list($categoria, $id_categoria, $count)=mysql_fetch_row($result))
			 {
				echo "<a href=\"oracle.php?cat=$id_categoria\">$categoria ($count)</a></br>";	 
			 }
			 
echo"        </div></li></ul>
            </div>
          </div>
          
            <div class=\"dbx-box dbx-box-closed dbxid0\" id=\"meta7\" style=\"display: block;\">
            <h3 class=\"dbx-handle dbx-handle-cursor\" style=\"position: relative; display: block;\" title=\"a\">
              UNIX
              <a style=\"cursor: pointer;\" href=\"javascript:CambiaClass(6);\" id=\"menu7\" class=\"dbx-toggle dbx-toggle-closed\" title=\"click to open this box\">				&nbsp;
              </a>
            </h3>
            <div class=\"dbx-content\">
                     <ul><li> Categorias:
			  <div class=\"pag_menu_item_cat\">";
  $sql="SELECT A.SUBCATEGORIA,A.ID_SUBCATEGORIA, COUNT(*) 
		FROM 
			SUBCATEGORIAS A, CAT_ENTRADAS B, CATEGORIAS C, ENTRADAS D
		WHERE 
		 	 C.ID_CATEGORIA=A.ID_CATEGORIA AND
			 A.ID_SUBCATEGORIA=B.ID_SUBCATEGORIA AND
			 C.CATEGORIA='UNIX' AND
			 B.ID_ENTRADA=D.ID_ENTRADA AND
			 D.ACTIVO=1
		GROUP BY 
		 	A.SUBCATEGORIA, A.ID_SUBCATEGORIA
		 ORDER BY 
		 	A.ID_SUBCATEGORIA";
				
			 $result=mysql_query($sql);
			 while( list($categoria, $id_categoria, $count)=mysql_fetch_row($result))
			 {
				echo "<a href=\"unix.php?cat=$id_categoria\">$categoria ($count)</a></br>";	 
			 }
			 
			 
echo"        </div></li></ul>
            </div>
          </div>
          
            <div class=\"dbx-box dbx-box-closed dbxid0\" id=\"meta8\" style=\"display: block;\">
            <h3 class=\"dbx-handle dbx-handle-cursor\" style=\"position: relative; display: block;\" title=\"a\">
              RAC
              <a style=\"cursor: pointer;\" href=\"javascript:CambiaClass(7);\" id=\"menu8\" class=\"dbx-toggle dbx-toggle-closed\" title=\"click to open this box\">				&nbsp;
              </a>
            </h3>
            <div class=\"dbx-content\">
                     <ul><li> Categorias:
			  <div class=\"pag_menu_item_cat\">";
  $sql="SELECT A.SUBCATEGORIA,A.ID_SUBCATEGORIA, COUNT(*) 
		FROM 
			SUBCATEGORIAS A, CAT_ENTRADAS B, CATEGORIAS C, ENTRADAS D
		WHERE 
		 	 C.ID_CATEGORIA=A.ID_CATEGORIA AND
			 A.ID_SUBCATEGORIA=B.ID_SUBCATEGORIA AND
			 C.CATEGORIA='RAC' AND
			 B.ID_ENTRADA=D.ID_ENTRADA AND
			 D.ACTIVO=1
		GROUP BY 
		 	A.SUBCATEGORIA, A.ID_SUBCATEGORIA
		 ORDER BY 
		 	A.ID_SUBCATEGORIA";
				
			 $result=mysql_query($sql);
			 while( list($categoria, $id_categoria, $count)=mysql_fetch_row($result))
			 {
				echo "<a href=\"rac.php?cat=$id_categoria\">$categoria ($count)</a></br>";	 
			 }
			 

echo"        </div></li></ul>
            </div>
          </div>
          
            <div class=\"dbx-box dbx-box-closed dbxid0\" id=\"meta9\" style=\"display: block;\">
            <h3 class=\"dbx-handle dbx-handle-cursor\" style=\"position: relative; display: block;\" title=\"a\">
              SCRIPTS
              <a style=\"cursor: pointer;\" href=\"javascript:CambiaClass(8);\" id=\"menu9\" class=\"dbx-toggle dbx-toggle-closed\" title=\"click to open this box\">				&nbsp;
              </a>
            </h3>
            <div class=\"dbx-content\">
                     <ul><li> Categorias:
			  <div class=\"pag_menu_item_cat\">";
  $sql="SELECT A.SUBCATEGORIA,A.ID_SUBCATEGORIA, COUNT(*) 
		FROM 
			SUBCATEGORIAS A, CAT_ENTRADAS B, CATEGORIAS C, ENTRADAS D
		WHERE 
		 	 C.ID_CATEGORIA=A.ID_CATEGORIA AND
			 A.ID_SUBCATEGORIA=B.ID_SUBCATEGORIA AND
			 C.CATEGORIA='SCRIPTS' AND
			 B.ID_ENTRADA=D.ID_ENTRADA AND
			 D.ACTIVO=1
		GROUP BY 
		 	A.SUBCATEGORIA, A.ID_SUBCATEGORIA
		 ORDER BY 
		 	A.ID_SUBCATEGORIA";
				
			 $result=mysql_query($sql);
			 while( list($categoria, $id_categoria, $count)=mysql_fetch_row($result))
			 {
				echo "<a href=\"scripts.php?cat=$id_categoria\">$categoria ($count)</a></br>";	 
			 }
			 
echo"		 </li>
              </ul>
            </div>
          </div>
      </div>
</div>";
ob_end_flush();
?>